﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xtensive.IoC;
using Xtensive.IoC.Configuration;
using System.Configuration;
using ConfigurationSection=Xtensive.IoC.Configuration.ConfigurationSection;

namespace ManualServiceRegistration.IoC
{
  public class MyDomainServiceContainer : ServiceContainerBase
  {
    public IServiceContainer container = null;

    protected override IEnumerable<object> HandleGetAll(Type serviceType)
    {
      return container.GetAll(serviceType);
    }

    protected override object HandleGet(Type serviceType, string name)
    {
      return container.Get(serviceType, name);
    }

    public MyDomainServiceContainer(object configuration, IServiceContainer parent)
      : base(parent)
    {
      var section = (ConfigurationSection) ConfigurationManager.GetSection("Xtensive.IoC");
      container = ServiceContainer.Create(section, "myDomainContainer");
    }
  }
}
